local skel = fk.CreateSkill{
  name = "div_heg__biaozhao"
}
local H = require "packages/hegemony/util"
---@type ActiveSkillSpec
local biaozhao = {
  anim_type = "control",
  card_num = 0,
  target_num = 2,
  card_filter = Util.FalseFunc,
  prompt = "#div_heg__biaozhao-prompt",
  target_filter = function(self, to_select, selected)
    return #selected < 2 and (#selected == 0 or (not H.compareKingdomWith(Fk:currentRoom():getPlayerById(selected[1]), Fk:currentRoom():getPlayerById(to_select))))
     and to_select ~= Self.id
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
  end,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local to1 = room:getPlayerById(effect.tos[1])
    local to2 = room:getPlayerById(effect.tos[2])
    local card = Fk:cloneCard("known_both")
    card.skillName = self.name
    local use = {
      from = player.id,
      tos = {{to1.id}},
      card = card,
    }
    room:useCard(use)
    if not player.dead and not player:isNude() then
      local cid = room:askForCard(player, 1, 1, true, self.name, false, ".", "#div_heg__biaozhao-choose:"..to2.id)
      if cid then
        room:obtainCard(to2, cid, false, fk.ReasonGive, player.id)
        if not player.dead then
          player:drawCards(1, self.name)
        end
      end
    end
  end
}
skel:addEffect("active", biaozhao)
return skel